package com.heg.bk.control;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.heg.bk.service.DataDictManagerService;
import com.comm.util.pages.PageUtils;

/**
 * 数据字典控制层
 * @author dengxuzhao
 * @time 2016-05-01
 */
@RequestMapping(value = "/hegbk/dict")
@Controller("dataDictionaryManagerAction")
public class DataDictionaryManagerAction {
	
	@Resource
	private DataDictManagerService dataDictService;
	
	/**
	 * 数据字典列表
	 * @param model
	 * @param currPage 当前页码
	 * @param pageSize 页容量
	 * @return
	 */
	@RequestMapping(value = "/lst", method = {RequestMethod.POST, RequestMethod.GET})
	public String lst_DataDictionary(Model model, 
			@RequestParam(value = "currPage", required = false) String currPage,
			@RequestParam(value = "pageSize", required = false) String pageSize){
		Integer cPage = 1;
		Integer pageS = 15;
		if(currPage != null && !"".equals(currPage)){
			cPage = Integer.parseInt(currPage);
		}
		
		if(pageSize != null && !"".equals(pageSize)){
			pageS = Integer.parseInt(pageSize);
		}
		Integer recordCount = dataDictService.select_dataDictToRecord(null, null);
		PageUtils pageUtils =  dataDictService.select_dataDictToPage(null, null, cPage, pageS, recordCount);
		model.addAttribute("pageUtils", pageUtils);
		return "html/bk-content/content-datadict";
	}
	
	/**
	 * 数据字典更新
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "/add", method = {RequestMethod.POST, RequestMethod.GET})
	public String add_dictParams(Model model){
		System.out.println("sdfdfdsf");
		System.out.println("dfdsfsfsdf");
		return "html/bk-content/content-datadict";
	}


}
